import java.util.Date;
import java.util.List;
import java.util.ArrayList;
public class A4 {

    // 客户类
    class Customer {
        private String name;
        private String contact;
        private String deliveryAddress;
        private boolean active;

        public Customer(String name, String contact, String deliveryAddress, boolean active) {
            this.name = name;
            this.contact = contact;
            this.deliveryAddress = deliveryAddress;
            this.active = active;
        }

        // Getter 和 Setter 方法
        public String getName() { return name; }
        public void setName(String name) { this.name = name; }
        public String getContact() { return contact; }
        public void setContact(String contact) { this.contact = contact; }
        public String getDeliveryAddress() { return deliveryAddress; }
        public void setDeliveryAddress(String deliveryAddress) { this.deliveryAddress = deliveryAddress; }
        public boolean isActive() { return active; }
        public void setActive(boolean active) { this.active = active; }
    }

    // 订单状态枚举
    enum OrderStatus {
        CREATE, PAID, SHIPPING, DELIVERED, CANCEL
    }

    // 订单类
    class Order {
        private Date createDate;
        private OrderStatus status;
        private List<OrderDetail> orderDetails = new ArrayList<>();
        private Customer customer;
        private Payment payment;

        public Order(Date createDate, OrderStatus status, Customer customer) {
            this.createDate = createDate;
            this.status = status;
            this.customer = customer;
        }

        // Getter 和 Setter 方法
        public Date getCreateDate() { return createDate; }
        public void setCreateDate(Date createDate) { this.createDate = createDate; }
        public OrderStatus getStatus() { return status; }
        public void setStatus(OrderStatus status) { this.status = status; }
        public List<OrderDetail> getOrderDetails() { return orderDetails; }
        public void setOrderDetails(List<OrderDetail> orderDetails) { this.orderDetails = orderDetails; }
        public Customer getCustomer() { return customer; }
        public void setCustomer(Customer customer) { this.customer = customer; }
        public Payment getPayment() { return payment; }
        public void setPayment(Payment payment) { this.payment = payment; }
    }

    // 订单详情类
    class OrderDetail {
        private Product product;
        private int quantity;

        public OrderDetail(Product product, int quantity) {
            this.product = product;
            this.quantity = quantity;
        }

        // Getter 和 Setter 方法
        public Product getProduct() { return product; }
        public void setProduct(Product product) { this.product = product; }
        public int getQuantity() { return quantity; }
        public void setQuantity(int quantity) { this.quantity = quantity; }

        public double calculateSubTotal() {
            return product.getPriceForQuantity(quantity) * quantity;
        }

        public double calculateWeight() {
            return product.getWeight() * quantity;
        }
    }

    // 商品项类
    class Product {
        private String title;
        private double weight;
        private String description;

        public Product(String title, double weight, String description) {
            this.title = title;
            this.weight = weight;
            this.description = description;
        }

        // Getter 和 Setter 方法
        public String getTitle() { return title; }
        public void setTitle(String title) { this.title = title; }
        public double getWeight() { return weight; }
        public void setWeight(double weight) { this.weight = weight; }
        public String getDescription() { return description; }
        public void setDescription(String description) { this.description = description; }

        public double getPriceForQuantity(int quantity) {
            // 这里假设价格与数量无关，可以根据实际需求修改
            // 例如：可以提供折扣等
            return getPrice();
        }

        // 假设每个商品有一个固定的价格，可以根据实际需求添加价格属性
        public double getPrice() {
            // 示例：固定价格100.0
            return 100.0;
        }
    }

    // 支付方式接口
    interface Payment {
        double getAmount();
    }

    // 信用卡支付方式类
    class Credit implements Payment {
        private String number;
        private String type;
        private String expireDate;
        private double amount;

        public Credit(String number, String type, String expireDate, double amount) {
            this.number = number;
            this.type = type;
            this.expireDate = expireDate;
            this.amount = amount;
        }

        // Getter 和 Setter 方法
        public String getNumber() { return number; }
        public void setNumber(String number) { this.number = number; }
        public String getType() { return type; }
        public void setType(String type) { this.type = type; }
        public String getExpireDate() { return expireDate; }
        public void setExpireDate(String expireDate) { this.expireDate = expireDate; }

        @Override
        public double getAmount() { return amount; }
        public void setAmount(double amount) { this.amount = amount; }
    }

    // 现金支付方式类
    class Cash implements Payment {
        private double cashTendered;
        private double amount;

        public Cash(double cashTendered, double amount) {
            this.cashTendered = cashTendered;
            this.amount = amount;
        }

        // Getter 和 Setter 方法
        public double getCashTendered() { return cashTendered; }
        public void setCashTendered(double cashTendered) { this.cashTendered = cashTendered; }

        @Override
        public double getAmount() { return amount; }
        public void setAmount(double amount) { this.amount = amount; }
    }

    // 在线转账支付方式类
    class WireTransfer implements Payment {
        private String bankID;
        private String bankName;
        private double amount;

        public WireTransfer(String bankID, String bankName, double amount) {
            this.bankID = bankID;
            this.bankName = bankName;
            this.amount = amount;
        }

        // Getter 和 Setter 方法
        public String getBankID() { return bankID; }
        public void setBankID(String bankID) { this.bankID = bankID; }
        public String getBankName() { return bankName; }
        public void setBankName(String bankName) { this.bankName = bankName; }

        @Override
        public double getAmount() { return amount; }
        public void setAmount(double amount) { this.amount = amount; }
    }

    // 支付宝支付方式类
    class AliPay implements Payment {
        private String number;
        private double amount;

        public AliPay(String number, double amount) {
            this.number = number;
            this.amount = amount;
        }

        // Getter 和 Setter 方法
        public String getNumber() { return number; }
        public void setNumber(String number) { this.number = number; }

        @Override
        public double getAmount() { return amount; }
        public void setAmount(double amount) { this.amount = amount; }
    }

    // 微信支付方式类
    class WeixinPay implements Payment {
        private String number;
        private double amount;

        public WeixinPay(String number, double amount) {
            this.number = number;
            this.amount = amount;
        }

        // Getter 和 Setter 方法
        public String getNumber() { return number; }
        public void setNumber(String number) { this.number = number; }

        @Override
        public double getAmount() { return amount; }
        public void setAmount(double amount) { this.amount = amount; }
    }
}
